package devcken.net.socket;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import devcken.runtime.EventArgs;

public class TransferEventArgs extends EventArgs<Header>
{
	private ByteArrayOutputStream _dataStream;
	
	private Object _dataObject;
	
	private String _dataMessage;
	
	public TransferEventArgs(Object sender, Header argument)
	{
		super(sender, argument);
	}
	
	public TransferEventArgs(Object sender, Header argument, byte[] data)
	{
		this(sender, argument);
		
		try
		{
			this._dataStream = new ByteArrayOutputStream();
			
			this._dataStream.write(data);
			
			this._dataStream.reset();
		}
		catch (IOException error)
		{
			
		}
	}
	
	public TransferEventArgs(Object sender, Header argument, Object dataObject)
	{
		this(sender, argument);
		
		this._dataObject = dataObject;
	}
	
	public TransferEventArgs(Object sender, Header argument, String dataMessage)
	{
		this(sender, argument);
		
		this._dataMessage = dataMessage;
	}

	public ByteArrayOutputStream getDataStream()
	{
		return this._dataStream;
	}

	public Object getDataObject()
	{
		return this._dataObject;
	}

	public String getDataMessage()
	{
		return this._dataMessage;
	}	
}